#!/usr/bin/env python
# -*- coding: utf-8 -*-
#

import time


def encode_join(data_iterable) :
    data = [ str(x) for x in data_iterable ]
    return ','.join(data)
    ## encode()

def decode_split(data) :
    data_list = data.split(',')
    return [ int(x) for x in data_list ]
    ## decode()

def test_join_split() :
    time_start = time.time()
    times = 100000
    
    t = [1234567890, 0, 0, 1234, 5678]

    for i in xrange(times) :
        x = encode_join( t )
        y = decode_split( x )
        assert t == y
        
    time_last = time.time() - time_start
    tps = times / time_last
    print 'codec %d times last %.2f seconds, tps=%.2f' % (times, time_last, tps)
    ## test_join_split()


test_join_split()


